Skip to content

Instantly share code, notes, and snippets.

View RakibFiha's full-sized avatar
🏠
Working from home

Rakib Fiha RakibFiha

🏠
Working from home
View GitHub Profile
// find element without pair in array
def solution(A):
A.sort()
for index in range(0,len(A),2):
if A[index] != A[index+1]:
return A[index]
B = [5,6,2,9,2,3,6,7,3,1,7,9,1]
print(solution(B))
@giner
giner / configure_bash.sh
Created October 24, 2019 14:01
BASH: add some usefulness
## bash: keep longer history
sed -i 's/^HISTSIZE=1000$/HISTSIZE=10000/' ~/.bashrc
sed -i 's/^HISTFILESIZE=2000$/HISTFILESIZE=20000/' ~/.bashrc
## Enable search through history with PgUp/PgDn
cat > ~/.inputrc << 'EOF'
$include /etc/inputrc
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
@allenday
allenday / zero-fee-bitcoin-tx.sql
Created January 25, 2019 07:39
Find zero-fee Bitcoin transactions
SELECT
ROUND((input_value - output_value)/ size, 0) AS fees_per_byte,
COUNT(*) AS txn_cnt
FROM
`bigquery-public-data.crypto_bitcoin.transactions`
WHERE TRUE
AND block_timestamp >= '2018-01-01'
AND is_coinbase IS FALSE
GROUP BY 1
@tkuchiki
tkuchiki / bats.log
Last active May 16, 2023 11:07
Example Bats
##### setup start
BATS_TEST_NAME: test_example_status_and_output-2c_lines
BATS_TEST_FILENAME: /home/bats/test.bats
BATS_TEST_DIRNAME: /home/bats
BATS_TEST_NAMES: test_example_status_and_output-2c_lines
BATS_TEST_DESCRIPTION: example status and output, lines
BATS_TEST_NUMBER: 1
BATS_TMPDIR: /tmp
##### setup end
example 1
@CMCDragonkai
CMCDragonkai / typeofvar.sh
Last active May 19, 2023 01:00
Bash: Get the type of a variable
#!/usr/bin/env bash
typeofvar () {
local type_signature=$(declare -p "$1" 2>/dev/null)
if [[ "$type_signature" =~ "declare --" ]]; then
printf "string"
elif [[ "$type_signature" =~ "declare -a" ]]; then
printf "array"
@mrtns
mrtns / gist:78d15e3263b2f6a231fe
Last active October 11, 2023 21:20
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@colindean
colindean / generate_bitcoin_address.sh
Last active October 12, 2023 23:45
Bitcoin address generator in bash
#!/bin/bash
#
# This is free and unencumbered software released into the public domain.
#
# Requires bc, dc, openssl, xxd
#
# by grondilu from https://bitcointalk.org/index.php?topic=10970.msg156708#msg156708
base58=({1..9} {A..H} {J..N} {P..Z} {a..k} {m..z})
bitcoinregex="^[$(printf "%s" "${base58[@]}")]{34}$"
@tomysmile
tomysmile / setup-vagrant-macosx.md
Created April 26, 2016 05:54
How to Install Virtualbox and Vagrant on MacOSX

Install Virtualbox && Vagrant for MacOSX

Vagrant uses Virtualbox to manage the virtual dependencies. You can directly download virtualbox and install or use homebrew for it.

$ brew cask install virtualbox

Now install Vagrant either from the website or use homebrew for installing it.

@lumengxi
lumengxi / Makefile
Created March 17, 2016 16:44
Makefile for Python projects
.PHONY: clean-pyc clean-build docs clean
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
@atiensivu
atiensivu / GnomeShellExtensions
Created September 11, 2017 20:13
Gnome Tweak Tool - enable user themes - No such schema “org.gnome.shell.extensions.user-theme”
sudo cp $HOME/.local/share/gnome-shell/extensions/user-theme@gnome-shell-extensions.gcampax.github.com/schemas/org.gnome.shell.extensions.user-theme.gschema.xml /usr/share/glib-2.0/schemas && sudo glib-compile-schemas /usr/share/glib-2.0/schemas
# One liner fix that shouldn't be necessary