Skip to content

Instantly share code, notes, and snippets.

module.exports = {
googleClientID: "YOUR_GOOGLE_CLIENT_ID",
googleClientSecret: "YOUR_CLIENT_SECRET"
}
#!/home/umar/.nvm/versions/node/v8.11.3/bin/node
let fs = require("fs");
let text = fs.readFileSync("text.txt", "utf-8");
text.split("\n").forEach(function(line) {
let reverse = line.split("").reverse().join("")
if (line.toLowerCase() === reverse) {
console.log("Detected palindrome at:", line);
}

React Native Folder Structure

Motivations

  • Sharing what has worked for me in different React Native projects
  • Reusing screens in different parts of your app
  • Easy to work separately in a feature
  • Add an extra level (nested folder) only when necessary
  • Don't overuse index.js for everything
# Extract many files with one command
function extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar Jxvf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
@xurwy
xurwy / m4a-to-mpr.md
Created April 24, 2020 08:07 — forked from pftg/m4a-to-mpr.md
Compress m4a with audio notes
ffmpeg -i tmp/audio-notes.m4a -acodec libmp3lame -aq 9 tmp/audio-notes.mp3
for file in *.m4a ; do ffmpeg -i $file -acodec libmp3lame -aq 9 ${file%.m4a}.mp3 ; done
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
// Compile : $ clang add.c -lpthread -w -o add
// atau $ gcc add.c -lpthread -w -o add
// https://stackoverflow.com/questions/24947446/pthread-create-how-do-i-get-the-returned-value-from-the-passed-function
#define TOTAL_CPU 8
#define LOOP_MAX 800000000 // LOOP_MAX nilainya sebesar memory fisik yang tersedia, jika terlalu besar akan segfault
#define LOOP_THREAD LOOP_MAX/TOTAL_CPU
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int ipAddress = wifiInfo.getIpAddress();
String ipString = String.format("%d.%d.%d.%d", (ip & 0xff), (ip >> 8 & 0xff), (ip >> 16 & 0xff), (ip >> 24 & 0xff));
@xurwy
xurwy / update-golang.md
Created July 12, 2021 05:03 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

package main
import (
"fmt"
"encoding/json"
)
var b = []byte(`{
"Module": [
{
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
// unmark pthread_detach(), memory leak will be gone
void* process( void* data ) {
printf( "hello world\n" );
}
main() {