Skip to content

Instantly share code, notes, and snippets.

View daljeet-singh's full-sized avatar

Daljeet Singh daljeet-singh

View GitHub Profile
@klesouza
klesouza / beam_parquet_dynamicdestination.py
Last active March 23, 2023 11:32
Apache Beam Python SDK - write Parquet files with dynamic destinations
class ParquetSink(beam.io.fileio.FileSink):
def __init__(self,
file_path_prefix,
schema,
row_group_buffer_size=64 * 1024 * 1024,
record_batch_size=1000,
codec='none',
use_deprecated_int96_timestamps=False,
file_name_suffix='',
num_shards=0,
@marclamberti
marclamberti / Airflow Version
Last active November 27, 2022 06:54
the_complete_hands_on_introduction_to_apache_airflow
2.1.0
<?php
/***********************************************************
MYSQL VERSION
************************************************************/
$username="root"; $password=""; $database="exam_codes";
$con = mysql_connect("localhost",$username,$password) or die( "Unable to Connect database");
mysql_select_db($database,$con) or die( "Unable to select database");
// Table Name that you want
// to export in csv
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active July 24, 2024 23:47
crack activate Office on mac with license file
@OussaZaki
OussaZaki / euler2_2.py
Created June 26, 2017 15:09
Better implementation of Project Euler #2: Even Fibonacci numbers.
def even_fibonacci_sum(n):
fn_2 = 2 #Fn-2
fn_1 = 8 #Fn-1
sum = 10 #first even number Fn-2 + Fn-1
while True :
fn = 4 * fn_1 + fn_2
if fn >= n: return sum
sum += fn
fn_2, fn_1 = fn_1, fn
<?php
/*
|--------------------------------------------------------------------------
| Excel To Array
|--------------------------------------------------------------------------
| Helper function to convert excel sheet to key value array
| Input: path to excel file, set wether excel first row are headers
| Dependencies: PHPExcel.php include needed
*/
function excelToArray($filePath, $header=true){
@four43
four43 / install-redis.sh
Last active April 18, 2021 04:03 — forked from dstroot/install-redis.sh
Install Redis
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/four43/e00d01ca084c5972f229/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@irazasyed
irazasyed / manage-etc-hosts.sh
Created March 7, 2015 09:16
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1
@shantanusingh
shantanusingh / Tesseract-Amazon-AMI.md
Last active September 19, 2023 10:10
Tesseract on Amazon-AMI

sudo yum update

##Install Redis https://gist.github.com/dstroot/2776679

wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
chmod 777 install-redis.sh
./install-redis.sh

@messified
messified / php-interview.md
Last active July 1, 2024 05:15
PHP Engineer Interview: What you should know

PHP Developer Interview: What you should know

1. What’s the difference between " self " and " this " ?

Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.

Source: When to use self vs this -stackoverflow