Skip to content

Instantly share code, notes, and snippets.

@jc00ke
jc00ke / llvm-update-alternatives
Created November 4, 2014 02:19
LLVM & clang alternatives
#!/usr/bin/env sh
sudo update-alternatives --install \
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-3.4 200 \
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-3.4 \
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.4 \
--slave /usr/bin/llvm-bcanalyzer llvm-bcanalyzer /usr/bin/llvm-bcanalyzer-3.4 \
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-3.4 \
--slave /usr/bin/llvm-diff llvm-diff /usr/bin/llvm-diff-3.4 \
--slave /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-3.4 \
@jc00ke
jc00ke / install-instructions.md
Created August 7, 2023 17:51 — forked from crispyricepc/install-instructions.md
wlprop - An xprop clone for wlroots based compositors

Dependencies

Make sure you have installed the following commands:

  • swaymsg
  • jq
  • slurp
  • awk

Installation

@jc00ke
jc00ke / submit.md
Created December 20, 2018 17:46 — forked from tanaikech/submit.md
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript

This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
    • Before you use this, please enable Drive API at API console and carry out the installation of gapi.
  • When this script is run, a text file including "sample text" is created to Google Drive.
  • When you use this script, please set fileContent and metadata.

In this sample script, a text file including contents is created under a folder.

@jc00ke
jc00ke / firefox-snap-to-deb.sh
Last active July 14, 2023 06:24
Migrate Firefox from snap back to deb on Ubuntu Jammy+
#!/bin/env bash
sudo snap remove firefox
sudo add-apt-repository ppa:mozillateam/ppa
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/mozilla-firefox
" from https://github.com/aduros/dotfiles/blob/eab476fc62e74e46cb41bb5c094cede7a28a014f/home/.config/nvim/options.vim#L27
autocmd BufNewFile,BufRead *.hx set filetype=haxe
autocmd BufNewFile,BufRead *.jsfl set filetype=javascript
autocmd BufNewFile,BufRead ~/.config/dunst/dunstrc set filetype=dosini
autocmd BufNewFile,BufRead ~/.config/polybar/config set filetype=dosini
autocmd BufNewFile,BufRead ~/.config/tridactyl/tridactylrc set filetype=vim
autocmd BufNewFile,BufRead ~/.config/zathura/zathurarc set filetype=config
autocmd BufNewFile,BufRead ~/.lesskey set filetype=config
@jc00ke
jc00ke / arch-linux-install
Last active April 2, 2023 19:10 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# This assumes a wifi only system...
@jc00ke
jc00ke / help.sh
Last active September 9, 2022 16:28
#!/bin/bash
# from https://gist.github.com/kovetskiy/a4bb510595b3a6b17bfd1bd9ac8bb4a5#gistcomment-3367404
set -o pipefail
Help=$(cat <<-"HELP"
my-script — does one thing well
Usage:
@jc00ke
jc00ke / nginx-config-auth-cert-ssl.md
Created July 14, 2022 20:04 — forked from alexishida/nginx-config-auth-cert-ssl.md
Tutorial to configure Nginx client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Original: https://gist.github.com/mtigas/952344

Convert SSL certificate from CRT format to PEM

openssl x509 -in server.crt -out server.der -outform DER
openssl x509 -in server.der -inform DER -out server.pem -outform PEM
@jc00ke
jc00ke / Convert PostgreSQL to SQLite
Created July 5, 2022 16:17 — forked from fiftin/Convert PostgreSQL to SQLite
Convert PostgreSQL to SQLite
1. Dump the data only sql to file
$ pg_dump --data-only --inserts YOUR_DB_NAME > dump.sql
2. scp to local
3. Remove the SET statements at the top
such as:
SET statement_timeout = 0;
SET client_encoding = 'SQL_ASCII';
4. Remove the setval sequence queries
#!/usr/bin/env bash
set -ex
trap 'handleError' ERR
handleError() {
echo ""
echo "If you encountered an error, please consider fixing"
echo "the script for your environment and creating a pull"