Skip to content

Instantly share code, notes, and snippets.

View Shidfar's full-sized avatar

Shidfar Hodizoda Shidfar

View GitHub Profile

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>

adb and fastboot must know

Install android SDK (bottom of the page) or full android studio if you need to develop on android.

fastboot looks like adb but it is used when device is in bootloader (or fastboot).

Check connected devices

adb:

@Shidfar
Shidfar / AdbCommands
Created September 11, 2018 07:11 — forked from Pulimet/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
@Shidfar
Shidfar / strict_aliasing.cpp
Last active June 11, 2018 14:51
playing with strict aliasing
#include <stdio.h>
typedef unsigned int DWORD;
typedef unsigned short WORD;
inline DWORD
SwapWords (DWORD val)
{
WORD * p = (WORD*) &val;
WORD t;
@Shidfar
Shidfar / idle-queries-psql.sql
Last active May 28, 2018 02:25
List and kill queries that are running more than XX minutes
-- What queries are running more than a second? --
SELECT pid FROM pg_stat_activity
WHERE pg_stat_activity.usename = 'username'
AND query != '<IDLE>'
AND query NOT ILIKE '%pg_stat_activity%'
AND age(clock_timestamp(), query_start) > '00:00:01';
-- Kill queries that are running more than 5 minutes --
WITH pgg AS (
SELECT pid
@Shidfar
Shidfar / container-bash-run.sh
Last active May 28, 2018 02:30
running bash in docker or in kubernetes
# run bash inside the docker container
docker exec -it $containerid bash
# for example:
# $ psql -U $postgresuser
# run bash in pod
kubectl exec -it $podname -- /bin/bash
@Shidfar
Shidfar / bobp-python.md
Created May 19, 2018 14:24 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
#!/bin/bash
export PREFIX="/usr/local/avr"
export EXTRAS="/usr/local/extras"
export INITIALDIR="/path/to/dev/folder/avr"
mkdir $PREFIX
mkdir $EXTRAS
# -------------- Binutils
@Shidfar
Shidfar / octave.md
Created May 9, 2018 02:38 — forked from obstschale/octave.md
An Octave introduction cheat sheet.

Octave CheatSheet

GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)

Basics

  • not equal ~=
  • logical AND &amp;&amp;
#!/bin/bash
git branch | grep -ve " master$" | xargs git branch -D