Skip to content

Instantly share code, notes, and snippets.

@limtbk
limtbk / recovery.sh
Last active July 11, 2021 03:09 — forked from jonathantneal/recovery.sh
Create or update macOS Mojave Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
@limtbk
limtbk / gist:d4b65eee982eaad8ae90d4541d416ef6
Last active March 26, 2019 19:18
Test exercise - caching class with FIFO
//
// main.m
// CacheImpl
//
// Created by lim on 3/26/19.
// Copyright © 2019 lim. All rights reserved.
//
#import <Foundation/Foundation.h>
#include <stdio.h>
#include <stdlib.h>
#define CONV_SIZE 180
#define RB_SIZE (CONV_SIZE*2)
#define BUFF_SIZE 4096
int8_t a[RB_SIZE];
int8_t b[RB_SIZE];
0 x x x x x x x
0 00 x0 x0 x0 x0 x0 x0 x0
x 0x xx xx xx xx xx xx xx
x 0x xx xx xx xx xx xx xx
x 0x xx xx xx xx xx xx xx
x 0x xx xx xx xx xx xx xx
x 0x xx xx xx xx xx xx xx
x 0x xx xx xx xx xx xx xx
x 0x xx xx xx xx xx xx xx
#include <Adafruit_NeoPixel.h>
const int LED_PIN = 2; //D4
// 0 - D3
// 1 - TX
// 2 - D4 LED
// 3 - RX
// 4 - D2
// 5 - D1
// 6 - halt
@limtbk
limtbk / t3.c
Last active January 23, 2018 07:20
You need text file "f" for input, that contains numbers divided by enter and ended by enter
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *f, *g, *h;
f = fopen("f", "r");
g = fopen("g", "w");
h = fopen("h", "w");
@limtbk
limtbk / t2.c
Last active January 23, 2018 06:07
#include <stdio.h>
void reverse_array(int *arr, int start, int end)
{
for (int i = start; i < (start + end) / 2; i++)
{
arr[i] ^= arr[end + start - i - 1];
arr[end + start - i - 1] ^= arr[i];
arr[i] ^= arr[end + start - i - 1];
}
@limtbk
limtbk / t1.c
Last active January 23, 2018 05:30
#include <stdio.h>
#define abs(x) ((x)<0 ? -(x) : (x))
double calc_prec(double x, double pr)
{
double s = 0;
double n = 1;
double k = 1;
double xx = x;
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#include "FS.h"
//const char ssid[] = "AnchorFree";
//const char pass[] = "wifi4free!";
@limtbk
limtbk / radio-t_record.sh
Created February 6, 2016 08:47
Record Radio-t podcast
#!/bin/bash
NOW=$(date +"%Y-%m-%d")
NUMBER=`cat radio-t_number`
RADIOTDIR=~/RadioT/${NUMBER}_${NOW}
mkdir -p $RADIOTDIR
cd $RADIOTDIR
while [ ! -f stream.m3u ]; do
wget http://stream.radio-t.com:8181/stream.m3u