Skip to content

Instantly share code, notes, and snippets.

@romaonthego
romaonthego / NSDateFormatter cheat sheet
Last active May 3, 2024 07:26
Date Formats for NSDateFormatter
a: AM/PM
A: 0~86399999 (Millisecond of Day)
c/cc: 1~7 (Day of Week)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
d: 1~31 (0 padded Day of Month)
D: 1~366 (0 padded Day of Year)
@sohukia
sohukia / C_CPP_VSCode_INSTALL.md
Last active May 3, 2024 07:25
Install and run C project on VSCode

Warning

This is only for Windows, for Linux or MacOS, please refer to another tutorial. Kiss kiss.

System installation requirements

  • chocolatey. This package will help us install the compiler MinGW and CMake. Just copy and paste this line in a Admin Powershell :
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install cmake
@kirbysayshi
kirbysayshi / lib_game_entities.js
Created July 29, 2013 04:25
rotatablegame.js: Rotate the camera in an impactjs game! Underscores in filenames indicate directories.
ig.module(
'game.entities.square'
)
.requires(
'impact.entity'
)
.defines(function(){
EntitySquare = ig.Entity.extend({
@chaiwa-berian
chaiwa-berian / Step 1: Create API User.MD
Last active May 3, 2024 07:24
Testing MTN MoMo Collection API in Sandbox using Postman

A. Checklist

  • To create an API User, you need the following things in place: X-Reference-Id and Ocp-Apim-Subscription-Key

1. X-Reference-Id

  • This is used as User ID since the Sandbox is a Mock Environment so we kinda create our own ids and send them over to the sandbox so it can uniquely identify the user
  • Get the value for this here: https://www.uuidgenerator.net/api/version4
  • Remember to keep this safely as we will use it when configuring our POST request
  • Lets say you have your X-Reference-Id as: 9f92971b-cd2e-4feb-9053-0b14d53ac4f5

2. Ocp-Apim-Subscription-Key

  • Get this from the Primary or Secondary Key of your Collections | Enable remote collection of bills, fees or taxes subscription.
@AlexisTM
AlexisTM / test.cpp
Created May 5, 2021 12:11
Print types of variables at runtime c++
#include <type_name.h>
#include <iostream>
class A {
public:
int a = 1;
int b = 2;
int c = 3;
};
@janasco
janasco / AnyDesk-Reset.cmd
Created August 3, 2023 09:46
AnyDesk Reset
@echo off & setlocal enableextensions
title Reset AnyDesk
reg query HKEY_USERS\S-1-5-19 >NUL || (echo Please Run as administrator.& pause >NUL&exit)
chcp 437
call :stop_any
del /f "%ALLUSERSPROFILE%\AnyDesk\service.conf"
del /f "%APPDATA%\AnyDesk\service.conf"
copy /y "%APPDATA%\AnyDesk\user.conf" "%temp%\"
rd /s /q "%temp%\thumbnails" 2>NUL
xcopy /c /e /h /r /y /i /k "%APPDATA%\AnyDesk\thumbnails" "%temp%\thumbnails"
@edjdavid
edjdavid / file.md
Created October 13, 2022 12:45
Stream Windows webcam/desktop via RTSP

Can be used for streaming data (webcam or screen capture) from the Windows to WSL

Install

  1. Simple RTSP Server
  2. ffmpeg

Get the internal IP of WSL

Run from a WSL terminal

ip route list default | awk '{print $3}'
@lsd
lsd / IdeaVim OS X Key Repeat.markdown
Last active May 3, 2024 07:22
Enable key-repeat for ALL applications or just for IdeaVim/specific JetBrains apps

Upgrading to Lion or Yosemite and WebStorm 9, I noticed key repeat was
turned off for the IdeaVim plugin h j k l keys.

System-wide key repeat

defaults write -g ApplePressAndHoldEnabled -bool false in a terminal will enable
key repeat for every app. This can alternatively be found in the accessibility settings in OS X' preferences.

App specific key repeat

@Hritik14
Hritik14 / 01-decrypt.js
Last active May 3, 2024 07:21
Encrypt aes 256 gcm in Java Springboot and decrypt in Nodejs
const {
pbkdf2Sync,
createDecipheriv,
} = require('crypto');
const algorithm = 'aes-256-gcm';
const password = 'ABCD';
const salt_hex = "FFFFFFFFFFFFFFFF"
const java_encrypted_base64 = "r8URnR8DLWFH1ipBoREtkwX6wi5x/japz85d+3e2BBWCrVs="
@kepano
kepano / obsidian-web-clipper.js
Last active May 3, 2024 07:21
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */