Skip to content

Instantly share code, notes, and snippets.

@hbasria
hbasria / postgresql-set-id-seq.sql
Created May 10, 2018 07:36 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@hbasria
hbasria / server.conf
Created April 27, 2018 14:19 — forked from Tristor/server.conf
OpenVPN server.conf
# Basic Connection Config
dev tun
proto udp
port 1194
keepalive 10 120
max-clients 5
# Certs
ca ca.crt
cert server.crt
@hbasria
hbasria / smtptest.py
Created April 24, 2018 06:15
smtp test
#!/usr/bin/python
"""smtptest.py: command-line smtp test mail sender
https://github.com/turbodog/python-smtp-mail-sending-tester
Usage: python smtptest.py [options] fromaddress toaddress serveraddress
Examples:
python smtptest.py [email protected] [email protected] mail.example.com
python smtptest.py --debuglevel 1 --usetls -u bob -p xyzzy "Bob <[email protected]>" [email protected] mail.example.com
At verbose == False and debuglevel == 0, smtptest will either succeed silently or print an error. Setting verbose or a debuglevel to 1 will generate intermediate output.
See also http://docs.python.org/library/smtplib.html
"""
<?php
/**
* Coin Dashboard by Christian Haschek
* https://blog.haschek.at
*
* Donations always welcome
* BTC: 1ChrisHMgr4DvEVXzAv1vamkviZNLPS7yx
* ETH: 0x1337C2F18e54d72d696005d030B8eF168a4C0d95
*
* Read more at
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@hbasria
hbasria / 0_reuse_code.js
Created January 17, 2017 07:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hbasria
hbasria / rename_git_branch.txt
Created October 21, 2016 08:05
rename git branch
1. switch to branch which needs to be renamed
2. git branch -m <new_name>
3. git push origin :<old_name>
4. git push origin <new_name>:refs/heads/<new_name>
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
@hbasria
hbasria / keybase.md
Last active September 13, 2019 13:45

Keybase proof

I hereby claim:

  • I am hbasria on github.
  • I am hbasria (https://keybase.io/hbasria) on keybase.
  • I have a public key ASAzGNiQsLhlHqgmTff9X8Z1GvuBnZ1XXCNMZ-WtO0eOYgo

To claim this, I am signing this object: