This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#mkdir -p { src/com/example/hellovirgool, obj, bin, res/layout, res/values, res/drawable} | |
#Define the help function | |
function help() { | |
echo "Options:" | |
echo "-package Package Name" | |
echo "-sdk SDK Path" | |
echo "-name Application Name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fa2EnDigits(str) { | |
str = String(str); | |
var e = '۰'.charCodeAt(0); | |
str = str.replace(/[۰-۹]/g, function (t) { | |
return t.charCodeAt(0) - e; | |
}); | |
e = '٠'.charCodeAt(0); | |
str = str.replace(/[٠-٩]/g, function (t) { | |
return t.charCodeAt(0) - e; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.linkedin.com/posts/ppx1400_ppx-progprox-afyahyabrafyahyabraepahyagpaeb-activity-6820335516840546304-eHMZ | |
function GtoJ(a){ | |
var e,d,c; | |
var n,m,l; | |
var b,h; | |
var k; | |
var f; | |
var gdays=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION "reset_sequence" (tablename text, columnname text, sequence_name text) | |
RETURNS "pg_catalog"."void" AS | |
$body$ | |
DECLARE | |
BEGIN | |
EXECUTE 'SELECT setval( ''' || sequence_name || ''', ' || '(SELECT MAX(' || columnname || | |
') FROM ' || tablename || ')' || '+1)'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_and_save_df(df, name='NoName', chunk_size=100, output_dir=''): | |
"""Split a dataframe and save each chunk in a different csv file. | |
Parameters: | |
df : data frame ( df = pd.read_csv('file.csv') | |
name : name of output file | |
chunk_size : chunk size | |
output_dir : directory where to write the divided dataframe | |
""" | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
$$ | |
declare | |
l_rec record; | |
begin | |
for l_rec in (select table_schema, table_name, column_name | |
from information_schema.columns | |
where table_schema = 'public' | |
and column_name = 'mount') loop | |
execute format ('alter table %I.%I rename column mount to amount', l_rec.table_schema, l_rec.table_name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🗑️ revert: | |
🐞 fix: | |
✨ feat: | |
💎 style: | |
♻️ chore: | |
📦 refactor: | |
🎉 build: | |
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Converting an int to a serial more or less only means adding a sequence default to the value, so to make it a serial; | |
-- Pick a starting value for the serial, greater than any existing value in the table | |
SELECT MAX(id)+1 FROM mytable | |
-- Create a sequence for the serial (tablename_columnname_seq is a good name) | |
CREATE SEQUENCE test_id_seq MINVALUE 3 (assuming you want to start at 3) | |
-- Alter the default of the column to use the sequence | |
ALTER TABLE test ALTER id SET DEFAULT nextval('test_id_seq') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Colors | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
WHITE='\033[0;m' | |
helpFunction() { | |
echo "***** USAGE *****" | |
echo "$0 -a add -m '<your message>'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.exceptions import PermissionDenied | |
class GroupRequiredMixin(object): | |
""" | |
group_required - list of strings, required param | |
""" | |
group_required = None |
OlderNewer