Snippets Collections
function processSQLFile(fileName) {

  // Extract SQL queries from files. Assumes no ';' in the fileNames
  var queries = fs.readFileSync(fileName).toString()
    .replace(/(\r\n|\n|\r)/gm," ") // remove newlines
    .replace(/\s+/g, ' ') // excess white space
    .split(";") // split into all statements
    .map(Function.prototype.call, String.prototype.trim)
    .filter(function(el) {return el.length != 0}); // remove any empty ones

  // Execute each SQL query sequentially
  queries.forEach(function(query) {
    batch.push(function(done) {
      if (query.indexOf("COPY") === 0) { // COPY - needs special treatment
        var regexp = /COPY\ (.*)\ FROM\ (.*)\ DELIMITERS/gmi;
        var matches = regexp.exec(query);
        var table = matches[1];
        var fileName = matches[2];
        var copyString = "COPY " + table + " FROM STDIN DELIMITERS ',' CSV HEADER";
        var stream = client.copyFrom(copyString);
        stream.on('close', function () {
          done();
        });
        var csvFile = __dirname + '/' + fileName;
        var str = fs.readFileSync(csvFile);
        stream.write(str);
        stream.end();
      } else { // Other queries don't need special treatment
        client.query(query, function(result) {
          done();
        });
      }
    });
  });
}
import { MatDialogModule } from "@angular/material";
 Save has now changed to

import { MatDialogModule } from "@angular/material/dialog";

You have to reference the actual module inside the material folder:
v
User Object Cheat Sheet
N

o matter what system you’re working in, it is always critical to be able to identify information about the user who is accessing that system. Being able to identify who the user is, what their groups and/or roles are, and what other attributes their user record has are all important pieces of information that allow you to provide that user with a good experience (without giving them information they don’t need to have or shouldn’t have). ServiceNow gives administrators some pretty simple ways to identify this information in the form of a couple of user objects and corresponding methods. This article describes the functions and methods you can use to get information about the users accessing your system.



GlideSystem User Object

The GlideSystem (gs) user object is designed to be used in any server-side JavaScript (Business rules, UI Actions, System security, etc.). The following table shows how to use this object and its corresponding functions and methods.

Function/Method	Return Value	Usage
gs.getUser()	Returns a reference to the user object for the currently logged-in user.	var userObject = gs.getUser();
gs.getUserByID()	Returns a reference to the user object for the user ID (or sys_id) provided.	var userObject = gs.getUser().getUserByID('employee');
gs.getUserName()	Returns the User ID (user_name) for the currently logged-in user.
e.g. 'employee'	var user_name = gs.getUserName();
gs.getUserDisplayName()	Returns the display value for the currently logged-in user.
e.g. 'Joe Employee'	var userDisplay = gs.getUserDisplayName();
gs.getUserID()	Returns the sys_id string value for the currently logged-in user.	var userID = gs.getUserID();
getFirstName()	Returns the first name of the currently logged-in user.	var firstName = gs.getUser().getFirstName();
getLastName()	Returns the last name of the currently logged-in user.	var lastName = gs.getUser().getLastName();
getEmail()	Returns the email address of the currently logged-in user.	var email = gs.getUser().getEmail();
getDepartmentID()	Returns the department sys_id of the currently logged-in user.	var deptID = gs.getUser().getDepartmentID();
getCompanyID()	Returns the company sys_id of the currently logged-in user.	var companyID = gs.getUser().getCompanyID();
getCompanyRecord()	Returns the company GlideRecord of the currently logged-in user.	var company = gs.getUser().getCompanyRecord();
getLanguage()	Returns the language of the currently logged-in user.	var language = gs.getUser().getLanguage();
getLocation()	Returns the location of the currently logged-in user.	var location = gs.getUser().getLocation();
getDomainID()	Returns the domain sys_id of the currently logged-in user (only used for instances using domain separation).	var domainID = gs.getUser().getDomainID();
getDomainDisplayValue()	Returns the domain display value of the currently logged-in user (only used for instances using domain separation).	var domainName = gs.getUser().getDomainDisplayValue();
getManagerID()	Returns the manager sys_id of the currently logged-in user.	var managerID = gs.getUser().getManagerID();
getMyGroups()	Returns a list of all groups that the currently logged-in user is a member of.	var groups = gs.getUser().getMyGroups();
isMemberOf()	Returns true if the user is a member of the given group, false otherwise.	Takes either a group sys_id or a group name as an argument.

if(gs.getUser().isMemberOf(current.assignment_group)){
//Do something...
}

var isMember = gs.getUser().isMemberOf('Hardware');

To do this for a user that isn't the currently logged-in user...

var user = 'admin';
var group = "Hardware";
if (gs.getUser().getUserByID(user).isMemberOf(group)){
gs.log( gr.user_name + " is a member of " + group);
}

else{
gs.log( gr.user_name + " is NOT a member of " + group);
}
gs.hasRole()	Returns true if the user has the given role, false otherwise.	if(gs.hasRole('itil')){ //Do something... }
gs.hasRole()	Returns true if the user has one of the given roles, false otherwise.	if(gs.hasRole('itil,admin')){
//If user has 'itil' OR 'admin' role then Do something...
}
hasRoles()	Returns true if the user has any roles at all, false if the user has no role (i.e. an ess user).	if(!gs.getUser().hasRoles()){
//User is an ess user...
}
It is also very simple to get user information even if the attribute you want to retrieve is not listed above by using a ‘gs.getUser().getRecord()’ call as shown here…

//This script gets the user's title
gs.getUser().getRecord().getValue('title');


g_user User Object

The g_user object can be used only in UI policies and Client scripts. Contrary to its naming, it is not truly a user object. g_user is actually just a handful of cached user properties that are accessible to client-side JavaScript. This eliminates the need for most GlideRecord queries from the client to get user information (which can incur a fairly significant performance hit if not used judiciously).

g_user Property or Method	Return value
g_user.userName	User name of the current user e.g. employee
g_user.firstName	First name of the current user e.g. Joe
g_user.lastName	Last name of the current user e.g. Employee
g_user.userID	sys_id of the current user e.g. 681ccaf9c0a8016400b98a06818d57c7
g_user.hasRole()	True if the current user has the role specified, false otherwise. ALWAYS returns true if the user has the 'admin' role.

Usage: g_user.hasRole('itil')
g_user.hasRoleExactly()	True if the current user has the exact role specified, false otherwise, regardless of 'admin' role.

Usage: g_user.hasRoleExactly('itil')
g_user.hasRoles()	True if the current user has at least one role specified, false otherwise.

Usage: g_user.hasRoles('itil','admin')
It is often necessary to determine if a user is a member of a given group from the client as well. Although there is no convenience method for determining this from the client, you can get the information by performing a GlideRecord query. Here’s an example…

//Check to see if assigned to is a member of selected group
var grpName = 'YOURGROUPNAMEHERE';
var usrID = g_form.userID; //Get current user ID
var grp = new GlideRecord('sys_user_grmember');
grp.addQuery('group.name', grpName);
grp.addQuery('user', usrID);
grp.query(groupMemberCallback);
   
function groupMemberCallback(grp){
//If user is a member of selected group
    if(grp.next()){
        //Do something
        alert('Is a member');
    }
    else{
        alert('Is not a member');
    }
}
To get any additional information about the currently logged-in user from a client-script or UI policy, you need to use a GlideRecord query. If at all possible, you should use a server-side technique described above since GlideRecord queries can have performance implications when initiated from a client script. For the situations where there’s no way around it, you could use a script similar to the one shown below to query from the client for more information about the currently logged in user.

//This script gets the user's title
var gr = new GlideRecord('sys_user');
gr.get(g_user.userID);
var title = gr.title;
alert(title);


Useful Scripts

There are quite a few documented examples of some common uses of these script methods. These scripts can be found on the ServiceNow wiki.
>>> from enum import Enum
>>> class Build(Enum):
...   debug = 200
...   build = 400
... 

Build['debug']

my_list = [27, 5, 9, 6, 8]

def RemoveValue(myVal):
    if myVal not in my_list:
        raise ValueError("Value must be in the given list")
    else:
        my_list.remove(myVal)
    return my_list

print(RemoveValue(27))
print(RemoveValue(27))
from pandas_profiling import ProfileReport
profile = ProfileReport(df, title="Pandas Profiling Report")
profile.to_file("your_report.html")
import streamlit as st #import streamlit right after installing it to the system

st.header('''Temperature Conversion App''') #Head / App title

#Converting temperature to Fahrenheit 
st.write('''Slide to convert Celcius to Fahrenheit''')
value = st.slider('Temperature in Celcius')
 
st.write(value, '°C is ', (value * 9/5) + 32, '°F')
st.write('Conversion formula: (°C x 9/5) + 32 = °F')
 
#Converting temperature to Celcius
st.write('''Slide to convert Fahrenheit to Celcius''')
value = st.slider('Temperature in Fahrenheit')
 
st.write(value, '°F is ', (value - 32) * 5/9, '°C')
st.write('Conversion formula: (°F - 32) x 5/9 = °C')
new_stocks = {symbol: price * 1.02 for (symbol, price) in stocks.items()}

Code language: Python (python)
library(ggplot2)
library("ggpubr")
theme_set(
  theme_bw() +
    theme(legend.position = "top")
  )
puts ShopifyAPI::Order.find(:all, :params => {:status => 'any', :limit => 250})
const useSortableData = (items, config = null) => {
  const [sortConfig, setSortConfig] = React.useState(config);
  
  const sortedItems = React.useMemo(() => {
    let sortableItems = [...items];
    if (sortConfig !== null) {
      sortableItems.sort((a, b) => {
        if (a[sortConfig.key] < b[sortConfig.key]) {
          return sortConfig.direction === 'ascending' ? -1 : 1;
        }
        if (a[sortConfig.key] > b[sortConfig.key]) {
          return sortConfig.direction === 'ascending' ? 1 : -1;
        }
        return 0;
      });
    }
    return sortableItems;
  }, [items, sortConfig]);

  const requestSort = key => {
    let direction = 'ascending';
    if (sortConfig && sortConfig.key === key && sortConfig.direction === 'ascending') {
      direction = 'descending';
    }
    setSortConfig({ key, direction });
  }

  return { items: sortedItems, requestSort };
}
import org.apache.spark.sql.functions._

val sc: SparkContext = ...
val sqlContext = new SQLContext(sc)

import sqlContext.implicits._

val input = sc.parallelize(Seq(
  ("a", 5, 7, 9, 12, 13),
  ("b", 6, 4, 3, 20, 17),
  ("c", 4, 9, 4, 6 , 9),
  ("d", 1, 2, 6, 8 , 1)
)).toDF("ID", "var1", "var2", "var3", "var4", "var5")

val columnsToSum = List(col("var1"), col("var2"), col("var3"), col("var4"), col("var5"))

val output = input.withColumn("sums", columnsToSum.reduce(_ + _))

output.show()
{
    // Debugger Tool for Firefox has to be installed: https://github.com/firefox-devtools/vscode-firefox-debug
    // And Remote has to be enabled: https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_Desktop#enable_remote_debugging
    "version": "0.2.0",
    "configurations": [
        {
            "type": "firefox",
            "request": "launch",
            "name": "Launch Firefox against localhost",
            "url": "http://localhost:3000",
            "webRoot": "${workspaceFolder}",
            "enableCRAWorkaround": true,
            "reAttach": true,
            "reloadOnAttach": true,
            "reloadOnChange": {
                "watch": "${workspaceFolder}/**/*.ts",
                "ignore": "**/node_modules/**"
            }
        }
    ]
}
post_max_size = 750M 
upload_max_filesize = 750M   
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
private Entity RetrieveEntityById(IOrganizationService service, string strEntityLogicalName, Guid guidEntityId)

       {

           Entity RetrievedEntityById= service.Retrieve(strEntityLogicalname, guidEntityId, newColumnSet(true)); //it will retrieve the all attrributes

           return RetrievedEntityById;

       }

How to call?

Entity entity = RetrieveEntityById(service, "account", guidAccountId);
$(document).on('click', 'a[href^="#"]', function (event) {
    event.preventDefault();

    $('html, body').animate({
        scrollTop: $($.attr(this, 'href')).offset().top
    }, 500);
});
V3D predictedRPY = qt.ToEulerRPY();
float predictedRoll = predictedRPY.x;
float predictedPitch = predictedRPY.y;
ekfState(6) = (float)predictedRPY.z; // yaw
const AWS = require('aws-sdk')

// Configure client for use with Spaces
const spacesEndpoint = new AWS.Endpoint('nyc3.digitaloceanspaces.com');
const s3 = new AWS.S3({
    endpoint: spacesEndpoint,
    accessKeyId: 'ACCESS_KEY',
    secretAccessKey: 'SECRET_KEY'
});

// Add a file to a Space
var params = {
    Body: "The contents of the file",
    Bucket: "my-new-space-with-a-unique-name",
    Key: "file.ext",
};

s3.putObject(params, function(err, data) {
    if (err) console.log(err, err.stack);
    else     console.log(data);
});
const elementIsVisibleInViewport = (el, partiallyVisible = false) => {
  const { top, left, bottom, right } = el.getBoundingClientRect();
  const { innerHeight, innerWidth } = window;
  return partiallyVisible
    ? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) &&
        ((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
    : top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth;
};

// Examples
elementIsVisibleInViewport(el); // (not fully visible)
elementIsVisibleInViewport(el, true); // (partially visible)
Top 15 free Handbooks about Data Science / AI :

✅"Data Mining and Analysis":
https://lnkd.in/g2aAhzu

✅"Introduction to Data Science"
https://lnkd.in/gjv-vK5

✅"Python Data Science Handbook"
https://lnkd.in/gxcW3Ku

✅"Learning Pandas"
https://lnkd.in/gP6PYE2

✅"MACHINE LEARNING YEARNING"
https://lnkd.in/gXdYjzi

✅"Feature Engineering for Machine Learning"
https://lnkd.in/gVCGgEN

✅"The Hundred-Page Machine Learning Book"
https://lnkd.in/gNb22Qh

✅ "Introduction to Statistical Machine Learning"
https://lnkd.in/guFgpXD

✅"Statistics for Data Science"
https://lnkd.in/gBudWsA

✅"Natural Language Processing With Python"
https://lnkd.in/gCFKZAs

✅"The Deep Learning Textbook"
https://lnkd.in/gfBv4h5

✅ 600+ Q&As about: Stats, Python, Machine Learning, Deep Learning, NLP, CV
https://lnkd.in/gevhVrZ

✅A Comprehensive Guide to Machine Learning
https://lnkd.in/gAup7nA

✅ Dive into Deep Learning:
https://lnkd.in/gGu5uxW

✅Deep learning Masterpiece by Andrew Ng
https://lnkd.in/gU98mhj

✅Learning SQL:
https://lnkd.in/g5MGAv4
<div class="container h-100">
    <div class="row align-items-center h-100">
        <div class="col-6 mx-auto">
            <div class="jumbotron">
                I'm vertically centered
            </div>
        </div>
    </div>
</div>
# 复制到网盘,并显示实时传输进度,设置并行上传数为8

rclone copy -P /home/SunPma GD:/home/SunPma --transfers=8

# 如果需要服务端对服务端的传输可加以下参数(不消耗本地流量)

rclone copy 配置名称:网盘路径 配置名称:网盘路径 --drive-server-side-across-configs
playList.setOnMouseClicked(new EventHandler<MouseEvent>() {

    @Override
    public void handle(MouseEvent click) {

        if (click.getClickCount() == 2) {
           //Use ListView's getSelected Item
           currentItemSelected = playList.getSelectionModel()
                                                    .getSelectedItem();
           //use this to do whatever you want to. Open Link etc.
        }
    }
});
<script>
document.addEventListener('DOMContentLoaded', function() {
jQuery(function($){
$('.showme').click(function(){
$(this).closest('.elementor-section').next().slideToggle();
$(this).toggleClass('opened');
});
$('.closebutton').click(function(){
$(this).closest('.elementor-section').prev().find('.showme').click();
});
});
});
</script>
<style>
.showme a , .showme i , .showme img, .closebutton a, .closebutton i, .closebutton img{
cursor: pointer;
-webkit-transition: transform 0.34s ease;
transition : transform 0.34s ease;
}
.opened i , .opened img , .opened svg{
transform: rotate(90deg);
}
</style>
# install the base app
git clone https://github.com/nodenv/nodenv.git ~/.nodenv

# add nodenv to system wide bin dir to allow executing it everywhere
sudo ln -vs ~/.nodenv/bin/nodenv /usr/local/bin/nodenv

# compile dynamic bash extension to speed up nodenv - this can safely fail
cd ~/.nodenv
src/configure && make -C src || true
cd ~/

# install plugins
mkdir -p "$(nodenv root)"/plugins
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
git clone https://github.com/nodenv/nodenv-aliases.git $(nodenv root)/plugins/nodenv-aliases

# install a node version to bootstrap shims
nodenv install 14.7.0
nodenv global 14

# make shims available system wide
sudo ln -vs $HOME/.nodenv/shims/* /usr/local/bin/

# make sure everything is working
node --version
npm --version
npx --version
<div class="alert alert-success"> This is a success box, color = green </div>
<div class="alert alert-info"> This is an info box, color = blue </div>
<div class="alert alert-warning"> This is a warning box, color = orange </div>
<div class="alert alert-danger"> This is a danger box, color = red </div>
<script src="https://platform.linkedin.com/badges/js/profile.js" async defer type="text/javascript"></script>
<div class="linkedin-wrapper"><div class="linkedin-header"><div class="v2-h2-subhead grey">Navštívte naše profily</div></div><div class="buttons-div cms"><div class="div-block-39">
<script src="https://platform.linkedin.com/badges/js/profile.js" async defer type="text/javascript"></script>
<div class="badge-base LI-profile-badge" data-locale="en_US" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="tomaslodnan" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://sk.linkedin.com/in/tomaslodnan?trk=profile-badge">Tomas Lodnan</a></div>
<div class="badge-base LI-profile-badge" data-locale="en_US" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="regulipeter" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://sk.linkedin.com/in/regulipeter?trk=profile-badge">Peter Reguli</a></div>
<div class="badge-base LI-profile-badge" data-locale="cs_CZ" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="martin-durny-a1b16066" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://sk.linkedin.com/in/martin-durny-a1b16066?trk=profile-badge">Martin Durny</a></div>
</div></div>
let req = new Request("https://httpbin.org/post");
req.method = "post";
req.headers = {
	"x-something": "foo bar",
	"Content-Type": "application/json"
};
req.body = JSON.stringify({
	foo: "bar",
	qux: 42
});

// use loadJSON because the API answers with JSON
let res = await req.loadJSON();
log(JSON.stringify(res, null, 2));
qs = df['Quarter'].str.replace(r'(Q\d) (\d+)', r'\2-\1')
qs

0    1996-Q3
1    1996-Q4
2    1997-Q1
Name: Quarter, dtype: object

df['date'] = pd.PeriodIndex(qs, freq='Q').to_timestamp()
df

   Quarter       date
0  Q3 1996 1996-07-01
1  Q4 1996 1996-10-01
2  Q1 1997 1997-01-01
<?php
function support_init() {
  $labels = array(
    'name'          => _x('Support', 'post type general name', 'engine'),
    'menu_name'     => _x('Support', 'admin menu', 'engine'),
  );

  $args = array(
    'labels'             => $labels,
    'public'             => true, //false for disable single page and permalink
    'publicly_queryable' => true, //false for disable single page and permalink
    'has_archive'        => false, // true for create archive page
    'show_ui'            => true,
    'show_in_menu'       => true,
    'query_var'          => true,
    'rewrite'            => array('slug' => 'support', 'with_front'=> false),
    //'with_front'=> false for ignore wordpress permalink settings in post url (if we want diffrent permalink structure than regular blog)
    'capability_type'    => 'post', // page, post
    'hierarchical'       => false,
    'menu_position'      => 5,
    'menu_icon'          => 'dashicons-admin-tools',
    'supports'           => array('title', 'editor', 'thumbnail', 'author', 'revisions' 'excerpt', 'comments'),
  );
  register_post_type('support', $args);
}
add_action('init', 'support_init');


/* REGISTER TAXONOMY */
function support_taxonomies() {
	$labels = array(
		'name' => _x('Categories', '', 'engine'),
		'singular_name' => _x('Categories', '', 'engine'),
		'menu_name' => __('Categories', 'engine'),
	);
	$args = array(
		'hierarchical' => true,
		'labels' => $labels,
		'show_ui' => true,
		'show_admin_column' => true,
		'query_var' => true,
		'rewrite' => array('slug' => 'support_cat', 'with_front'=> false),
      	//'with_front'=> false for ignore wordpress permalink pettings in category url
	);
	register_taxonomy('support_cat', 'support', $args);
}
add_action('init', 'support_taxonomies', 0);


/* OPTIONAL: CUSTOM TAXONOMY SLUG URL */
// show category name for CPT in single post url

function support_taxonomy_slug_link( $post_link, $id = 0 ){
    $post = get_post($id);
    if ( is_object( $post ) ){
        $terms = wp_get_object_terms( $post->ID, 'support_cat' );
        if( $terms ){
            return str_replace( '%support_cat%' , $terms[0]->slug , $post_link );
        }
    }
    return $post_link;
}
add_filter( 'post_type_link', 'support_taxonomy_slug_link', 1, 3 );

// then change rewrite in function support_init() for this and will show /support/category_name/post_name
'rewrite' => array('slug' => 'support/%support_cat%'),
{#await promise}
	<!-- promise is pending -->
	<p>waiting for the promise to resolve...</p>
{:then value}
	<!-- promise was fulfilled -->
	<p>The value is {value}</p>
{:catch error}
	<!-- promise was rejected -->
	<p>Something went wrong: {error.message}</p>
{/await}
import {toJpeg} from 'html-to-image'
pivot_longer(
  data,
  cols,
  names_to = "name",
  names_prefix = NULL,
  names_sep = NULL,
  names_pattern = NULL,
  names_ptypes = list(),
  names_transform = list(),
  names_repair = "check_unique",
  values_to = "value",
  values_drop_na = FALSE,
  values_ptypes = list(),
  values_transform = list(),
  ...
)
#include<iostream> 
#include<string>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
using namespace std;


class Card		//Declare card class
{
public:
	friend ATM;//Declare friends
	Card::Card(string Name, int Account)//Constructor
	{
		name = Name;
		account = Account;
	}
protected:
	string name;//Cardholder's Name
	int account;//account number
};


class BankCard:public Card {
public:
	friend ATM;//Friend class ATM. Enable ATM class to access private members of bank card class
	BankCard(string Name, int Account, string Password, float Money)
		:Card(Name,Account)
	{
		password = Password;
		money = Money;
	};					//Constructor
private:
	string password;//password
	float money;//total amount
	
};

class ATM//ATM type, which simulates the main system of the self-service teller machine
{
public:
	void Information();//
	int check_password(int Account, string Password);//Verify account password function
	void transfer_money();//Transfer function
	void check_remain_money();//Query balance function
	void deposit();//Save money function
	void drawing();//Withdraw money function
	void change_password();//Modify password function
	ATM(string Name, int Account, string Password, float Money)
	{
		name = Name;
		account = Account;
		password = Password;
		money = Money;
	}
private:
	string password;//password
	float money;//total amount
	string name;//Cardholder's Name
	int account;//account number
	
};
void ATM::Information()
{
	cout<<"your name:"<<name<<endl;
	cout<<"Your account: " << account << endl;
	system("pause");//Output press any key to continue
	system("cls");//Clear screen function
}

void ATM::deposit()        //Save money function
 {
	float e_money;//Define the variable to store the amount to be deposited
	cout << "Please enter the amount you want to deposit" << endl;
	cin >> e_money;
	money += e_money;//Change the total amount
	cout << "Your balance is" << money << "yuan" << endl;
	system("pause");//Output press any key to continue
	system("cls");//Clear screen function
}

void ATM::drawing()        //Withdraw money function
{
	float e_money;//Define the variable to store the amount to be taken
	cout << "Please enter the amount you want to withdraw" << endl;
	cin >> e_money;
	if (e_money > money)//If the withdrawal is more than the total amount
		cout << "Insufficient account balance" << endl;
	else				//If the withdrawal is less than the total amount
	{	
		money -= e_money;
		cout << "Your balance is" << money << "yuan" << endl;
	}
	system("pause");//Output press any key to continue
	system("cls");//Clear screen function
}

void ATM::change_password()	// //Modify password function
{				
	string new_password1, new_password2, pwd;
	cout << "Please enter the original password: ";
	cin >> pwd;
	cout << endl;
	if (pwd == password)
	{
		cout << "Please enter a new password: ";
		cin >> new_password1;
		cout << endl;
		cout << endl;
		while (new_password1 == password)
		{
			cout << "The same as the old password, please enter a new password: ";
			cin >> new_password1;
			cout << endl;
		}
		cout << "Please enter the new password again: ";
		cin >> new_password2;
		cout << endl;
		while (new_password1 != new_password2)
		{
			cout << "Different from the first input, please input again: ";
			cin >> new_password2;
			cout << endl;
		}
		password = new_password2;
		cout << "password has been updated! " << endl;
		cout << endl;
	}
	else if (pwd != password) 
	{
		do {
			cout << "Wrong password, please re-enter: ";
			cin >> pwd;
		} while (pwd != password);
		change_password();
	}
	system("pause");//Output press any key to continue
	system("cls");//Clear screen function
}

void ATM::transfer_money() //Transfer function
{
	float Transfer_money = 0.0;//Define the variable to store the amount to be transferred
	cout << "Please enter the amount to be transferred" << endl;
	cin >> Transfer_money;
	if (Transfer_money > money)//If the transfer amount is greater than the total amount
		cout << "Insufficient account balance" << endl;
	else						//The transfer amount is less than the total amount
	{
		money -= Transfer_money;
		cout << "The operation was successful, your balance is" << money << "yuan" << endl;
	}
	system("pause");//Output press any key to continue
	system("cls");  //Clear screen function
}

void ATM::check_remain_money() {			//Check balances
	cout << "Your balance is" << money << endl;
	system("pause");//Output press any key to continue
	system("cls");//Clear screen function
}

int ATM::check_password(int Account, string Password)  //Verify account password function
{
	int i = 0;
	cout << "Please enter your account and password" << endl;
	for (i = 0; i < 3; i++)
	{           //Cannot exceed three attempts
		cout << "account number:";
		cin >> Account;
		cout << "password:";
		cin>>Password;
		if ((Account ==account)&&(Password == password))
		{
			cout << "Login to China Minsheng Bank successfully!" << endl
				<< "welcome!" << endl;
			return 1;
		}
		else 
		{
			cout << "Incorrect account or password, please re-enter" << endl;
			if (i >= 2)
			{
				cout << "You have tried more than three times and have been frozen" << endl;
				system("pause");//Output press any key to continue
			}
		}
	}
	return 0;
}


int main()
{
	ATM atm("Zhao Si",198754, "311817", 1314);


	//Define the ATM class object atm, call the constructor to assign values ​​to the private members
	int account;
	string password;
	int j = 0;
	int flag = 0;
	flag = atm.check_password(account, password);
	while (flag)
	{
		cout << "Please choose your needs: 1. Information query 2. Deposit money 3. Withdraw money 4. Change password 5. Transfer 6. Check balance 7. Exit" << endl;
		cin >> j;
		switch (j)
		{
		case 1:{atm.Information();break;}
		case 2:{atm.deposit(); break;}
		case 3:{atm.drawing(); break;}
		case 4:{atm.change_password(); break;}
		case 5:{atm.transfer_money(); break;}
		case 6:{atm.check_remain_money();break;}
		case 7:{break;}
		default:break;
		}
		if (j==6)break;
		if(j != 1 && j != 2 && j != 3 && j != 4 &&j != 5&&j!=6){
			cout<<"Please enter the correct command!"<<endl;
			system("pause");
			system("cls");
		}
	}
	return 0;
}
def open_google_sheet(wookbookname,sheet_num=0):
‘’’
Requests a Google sheet saved as ‘workbookname’ using credentials for developer email.
Credentials for Google API are stored in /Users/#########/.config/gspread/service_account.json
sheetname = The name of the Google sheet file as seen on Google. Entered as a string.
sheet_num = The sheet number for the Google Sheet. Defaults to 0 if no entry.
Parameters
 — — — — — 
workbookname: The name of the Google Sheet that you intend to open
sheet_num: The number of the sheet in the Google Sheet you intend to open (numbering begins at 0)
Returns
 — — — -
DataFrame: A DataFrame of the information contained in the Google Sheet
‘’’
scope = [‘https://spreadsheets.google.com/feeds',
‘https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name(
‘/Users/######/.config/gspread/service_account.json’, scope)
#If credentials change, must change json file.
gc = gspread.authorize(credentials)
wks = gc.open(f”{workbookname}”).get_worksheet(sheet_num)
data = wks.get_all_values()
headers = data.pop(0)
df = pd.DataFrame(data, columns=headers)
return df
function nextInLine(arr, item) {
  // Only change code below this line
  arr.push(item);
 
  return  arr.shift(item);
  // Only change code above this line
  

}

// Setup
var testArr = [1,2,3,4,5];

// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));
//Array of strings
var names = ["John", "Paul" , "Erica"];

//Arrays of number
var numbers = [1,2,3];
flutter build web --web-renderer canvaskit --release
flutter build web --web-renderer html --release
flutter build web --release (auto)
User::chunk(100, function ($users) {
  foreach ($users as $user) {
    $some_value = ($user->some_field > 0) ? 1 : 0;
    // might be more logic here
    $user->update(['some_other_field' => $some_value]);
  }
});
SELECT Column(s) FROM table_name WHERE column IN (value1, value2, ... valueN);
#!/bin/bash
echo "[+] Installing XFCE4, this will take a while"
apt-get update
apt-get dist-upgrade -y --force-yes
apt-get --yes --force-yes install kali-desktop-xfce xorg xrdp
echo "[+] Configuring XRDP to listen to port 3390 (but not starting the service)..."
sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
# install docker

 $ wget -nv -O - https://get.docker.com/ | sh

 # setup dokku apt repository

 $ wget -nv -O - https://packagecloud.io/dokku/dokku/gpgkey | apt-key add -

 $ export SOURCE="https://packagecloud.io/dokku/dokku/ubuntu/"

 $ export OS_ID="$(lsb_release -cs 2>/dev/null || echo "bionic")"

 $ echo "bionic focal" | grep -q "$OS_ID" || OS_ID="bionic"

 $ echo "deb $SOURCE $OS_ID main" | tee /etc/apt/sources.list.d/dokku.list

 $ apt-get update

 # install dokku

 $ apt-get install dokku

 $ dokku plugin:install-dependencies --core # run with root!

 # Configure your server domain via `dokku domains:set-global`

 # and user access (via `dokku ssh-keys:add`) to complete the installation
star

Fri Nov 27 2020 18:42:18 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/22636388/import-sql-file-in-node-js-and-execute-against-postgresql

@robertjbass #sql #nodejs

star

Tue Dec 15 2020 17:13:49 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/58594311/angular-material-index-d-ts-is-not-a-module

@dedicatedking #nodejs,angular

star

Fri Dec 11 2020 17:35:23 GMT+0000 (Coordinated Universal Time) https://servicenowguru.com/scripting/user-object-cheat-sheet/

@nhord2007@yahoo.com #servicenow #user #object

star

Sun Aug 30 2020 18:34:38 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41407414/convert-string-to-enum-in-python

@arielvol #python

star

Sun Mar 28 2021 06:58:45 GMT+0000 (Coordinated Universal Time)

@FlorianC #python

star

Wed Jan 26 2022 02:55:52 GMT+0000 (Coordinated Universal Time)

@jmbenedetto #python

star

Wed Feb 28 2024 07:51:24 GMT+0000 (Coordinated Universal Time) https://www.pythontutorial.net/python-basics/python-dictionary-comprehension/

@viperthapa #python

star

Sun Mar 21 2021 10:33:11 GMT+0000 (Coordinated Universal Time) https://www.datanovia.com/en/lessons/combine-multiple-ggplots-into-a-figure/

@ztlee042 #r

star

Mon Jun 22 2020 16:12:54 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/23824715/how-to-retrieve-orders-from-shopify-through-the-shopify-api-gem

@ayazahmadtarar #rb

star

Fri Dec 24 2021 18:05:03 GMT+0000 (Coordinated Universal Time) https://www.smashingmagazine.com/2020/03/sortable-tables-react/

@dickosmad #react.js #sorting

star

Mon Apr 05 2021 18:00:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/37624699/adding-a-column-of-rowsums-across-a-list-of-columns-in-spark-dataframe

@anoopsugur #scala

star

Thu Sep 02 2021 14:15:48 GMT+0000 (Coordinated Universal Time)

@jolo #setting #vscode

star

Thu Dec 09 2021 20:15:48 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/57110542/how-to-write-a-nvmrc-file-which-automatically-change-node-version

@richard #sh

star

Tue May 26 2020 11:49:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1263680/maximum-execution-time-in-phpmyadmin

@Ali Raza

star

Tue May 26 2020 18:32:44 GMT+0000 (Coordinated Universal Time) https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/157766/simple-c-code-to-retrieve-an-entity-record

@sabih53

star

Thu May 28 2020 15:25:13 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/7717527/smooth-scrolling-when-clicking-an-anchor-link

@dyaneld

star

Mon Jun 22 2020 19:57:38 GMT+0000 (Coordinated Universal Time) https://medium.com/building-autonomous-flight-software/the-math-behind-state-estimation-in-aerospace-software-66a15761049c

@arush

star

Sat Aug 08 2020 04:44:29 GMT+0000 (Coordinated Universal Time) https://www.digitalocean.com/community/questions/can-i-upload-images-to-spaces-using-node-js

@rdemo

star

Fri Oct 09 2020 23:33:40 GMT+0000 (Coordinated Universal Time) https://github.com/BrainJS/brain.js

@robertjbass

star

Mon Oct 12 2020 04:19:11 GMT+0000 (Coordinated Universal Time) https://madza.hashnode.dev/24-modern-es6-code-snippets-to-solve-practical-js-problems?guid

@mulitate4

star

Fri Jan 29 2021 19:18:47 GMT+0000 (Coordinated Universal Time)

@edwardga

star

Wed Mar 03 2021 19:37:38 GMT+0000 (Coordinated Universal Time) https://laravelarticle.com/laravel-barcode-tutorial

@fadas

star

Mon Jun 29 2020 07:34:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42252443/vertical-align-center-in-bootstrap-4

@peota

star

Sat Oct 31 2020 08:17:41 GMT+0000 (Coordinated Universal Time) https://sunpma.com/864.html

@natsumi88

star

Mon Nov 02 2020 08:47:35 GMT+0000 (Coordinated Universal Time)

@natsumi88

star

Thu Dec 03 2020 16:35:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/22542015/how-to-add-a-mouse-doubleclick-event-listener-to-the-cells-of-a-listview-in-java

@jasoncriss

star

Fri Jan 01 2021 08:33:58 GMT+0000 (Coordinated Universal Time)

@lewiseman

star

Tue Feb 02 2021 12:11:10 GMT+0000 (Coordinated Universal Time) https://github.com/blockstack/app-mining/pull/44

@cryptpkr

star

Fri Feb 26 2021 11:47:21 GMT+0000 (Coordinated Universal Time) https://element.how/elementor-show-hide-section/

@PFMC

star

Fri Mar 05 2021 21:30:08 GMT+0000 (Coordinated Universal Time) https://gist.dreamtobe.cn/mrbar42/faa10a68e32a40c2363aed5e150d68da

@faisalhumayun

star

Fri Mar 26 2021 00:53:41 GMT+0000 (Coordinated Universal Time) https://about.gitlab.com/handbook/markdown-guide/

@ktyle

star

Wed Apr 14 2021 10:04:23 GMT+0000 (Coordinated Universal Time)

@GoodRequest.

star

Fri Apr 30 2021 16:49:28 GMT+0000 (Coordinated Universal Time) https://blog.logrocket.com/learn-these-keyboard-shortcuts-to-become-a-vs-code-ninja/#:~:text=Selecting%20code&text=The%20alt%20%2B%20shift%20%2B%20left%20%2F,of%20code%20based%20on%20scope.

@mvieira

star

Sat May 08 2021 13:32:09 GMT+0000 (Coordinated Universal Time) https://www.reddit.com/r/Scriptable/comments/ir8cum/http_request_question/

@zangwang

star

Tue May 11 2021 15:02:51 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/53898482/clean-way-to-convert-quarterly-periods-to-datetime-in-pandas

@arielvol

star

Tue May 25 2021 09:27:30 GMT+0000 (Coordinated Universal Time)

@Sikor

star

Thu May 27 2021 18:39:49 GMT+0000 (Coordinated Universal Time) https://svelte.dev/

@omargnagy

star

Mon May 31 2021 19:08:00 GMT+0000 (Coordinated Universal Time)

@kushsingh

star

Tue Jun 01 2021 16:13:07 GMT+0000 (Coordinated Universal Time) https://tidyr.tidyverse.org/reference/pivot_longer.html

@rezaeir

star

Thu Jun 24 2021 13:17:59 GMT+0000 (Coordinated Universal Time)

@abdul_hanan

star

Fri Jun 25 2021 22:12:28 GMT+0000 (Coordinated Universal Time) https://towardsdatascience.com/3-essential-tips-to-start-using-google-data-studio-93334a403d11

@admariner

star

Wed Jun 30 2021 04:41:53 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/stand-in-line

@salmoon231

star

Fri Jul 09 2021 17:21:31 GMT+0000 (Coordinated Universal Time)

@buildadev

star

Mon Jul 26 2021 06:46:40 GMT+0000 (Coordinated Universal Time) https://flutter.dev/docs/development/tools/web-renderers

@vahid

star

Tue Aug 03 2021 04:26:08 GMT+0000 (Coordinated Universal Time) https://laraveldaily.com/process-big-db-table-with-chunk-method/

@mvieira

star

Fri Aug 13 2021 20:14:36 GMT+0000 (Coordinated Universal Time) https://www.journaldev.com/19165/sql-in-sql-not-in

@mvieira

star

Sat Aug 21 2021 16:04:58 GMT+0000 (Coordinated Universal Time) https://lolz.guru/market/17950329/

@SHAWTY

star

Sun Oct 24 2021 04:54:23 GMT+0000 (Coordinated Universal Time) https://gitlab.com/kalilinux/build-scripts/kali-wsl-chroot/-/blob/master/xfce4.sh

@gallinio

star

Mon Nov 08 2021 17:37:30 GMT+0000 (Coordinated Universal Time) https://dokku.com/

@pirate

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension