Skip to content

Instantly share code, notes, and snippets.

View muhajirinlpu's full-sized avatar
🎯
Focusing

Muhajirin Ilyas muhajirinlpu

🎯
Focusing
View GitHub Profile
@jctosta
jctosta / screen_cheatsheet.markdown
Last active July 28, 2024 08:46
Screen Cheatsheet

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
@sumanbh
sumanbh / postgres_sequence_sync.sql
Last active July 14, 2021 22:10
Postgresql PK sequence out of sync (fix)
--Select the max id(or your primary key)--
SELECT MAX(id) FROM *table*;
--See if the next value in the sequence is bigger than the max id--
SELECT nextval('*table*_id_seq');
--If it isn't make it bigger. This fixes "duplicate key violates unique constraint" error--
SELECT setval('*table*_id_seq', (SELECT MAX(id) FROM *table*)+1);
@soulduse
soulduse / MainActivity.java
Last active March 9, 2022 11:18
Android - using GPS in the WebView
package com.dave.webviewgps;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.GeolocationPermissions;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
@supix
supix / postgres_recovery.md
Last active June 6, 2024 18:46
Postgres error: Missing chunk 0 for toast value in pg_toast

The problem

In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.

One of the symptoms of such corruptions is the following message:

ERROR: missing chunk number 0 for toast value 123456 in pg_toast_45678

This almost surely indicates that a corrupted chunk is present within a table file. But there is a good way to get rid of it.

@umohi
umohi / download-github-artifact
Created September 21, 2018 22:48
use curl to download release artifact from github private repository
# in order to download release artifacts from github, you have to first retreive the
# list of asset URLs using the github repo REST API. Use the asset URL to download
# the artifact as a octet-stream data stream. You will need to get an access token
# from "settings -> developer settings -> personal access tokens" on the github UI
#!/bin/bash -e
owner="MY_ORG_NAME"
repo="MY_REPO_NAME"
tag="ARTIFACT_TAG"
artifact="ARTIFACT_NAME"
@etiennetremel
etiennetremel / README.md
Last active July 27, 2024 21:52
Simple Wireguard setup as VPN server and multiple clients

Simple WireGuard configuration

1 server, 2 clients

Getting started

Install Wireguard on all machines.

Generate all keys

SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:\x2d\x2dbold
SETUVAR fish_color_comment:red
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:brmagenta
SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:bryellow\x1e\x2d\x2dbold
SETUVAR fish_color_history_current:\x2d\x2dbold
#!/bin/bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
exec "$@"
@phoe
phoe / forever.md
Last active February 22, 2024 23:50
Forever Stable Branch

Forever Stable Branch

Stable branch, I can see you in the stable branch
See you again, I see you again
In my dreams, in my dreams, in my dreams, in my dreams

Morning light, I remember the morning li-i-i-i-ight
Outside my door (outside my door), I'll see you no more (see you no more)
In my dreams, in my dreams, in my dreams, in my dreams
>