Skip to content

Instantly share code, notes, and snippets.

@asm-jaime
asm-jaime / win10_ssd.md
Created September 25, 2016 11:51
how to configure windows 10 with ssd
  1. powercfg -h off
  2. disable indexation disk->options->allow the index file...
  3. disable Superfetch in control services
@asm-jaime
asm-jaime / shit_cast.js
Created October 2, 2016 14:13
resolve summ without cast (]:_>)
'use strict'
const super_cast = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const convert = (arr_char) => {
let real_num = 0;
for (let i = 0; i < arr_char.length; ++i) {
real_num = real_num + Math.pow(10, i) * super_cast.indexOf(arr_char[i]);
};
return real_num;
}
@asm-jaime
asm-jaime / average_fw.cpp
Created November 14, 2016 05:12
Average occurrence of the first word in sentence
#include <iostream>
#include <regex>
using namespace std;
int main()
{
regex sentense_regex("[^!?.]+");
string all_str;
string cmp_str;
@asm-jaime
asm-jaime / pthreads.c
Created December 30, 2016 17:15
ping pong (threads) c
#include <stdio.h>
#include <pthread.h>
void *ping_task(char *arg)
{
printf("ping %s", arg);
usleep(1);
return (NULL);
@asm-jaime
asm-jaime / processing_error.go
Created January 4, 2017 12:46
Easy Api Error
// ==================== easy error {{{
type EasyAPIError struct {
Errors []ErrorDetail `json:"errors"`
}
// ErrorDetail represents an individual item in an EasyAPIError.
type ErrorDetail struct {
Message string `json:"message"`
Code int `json:"code"`
}
@asm-jaime
asm-jaime / processing_http_error.go
Created January 4, 2017 12:56
Processing HTTP API errors
// #################### http error {{{
// ApiHttpError something
type ApiHttpError struct {
Code int `json:"errorCode"`
HttpCode int `json:"-"`
Message string `json:"errorMsg"`
Info string `json:"errorInfo"`
}
@asm-jaime
asm-jaime / object.merge.js
Created January 28, 2017 06:27
ways to merge objects (javascript)
'use strict';
function merge_arguments() {
let obj = {},
i = 0,
len = arguments.length,
key;
for (; i < len; i++) {
for (key in arguments[i]) {
if (arguments[i].hasOwnProperty(key)) {
@asm-jaime
asm-jaime / molokai.vifm
Last active January 30, 2017 13:07
vifm config
" You can edit this file by hand.
" The " character at the beginning of a line comments out the line.
" Blank lines are ignored.
" The Default color scheme is used for any directory that does not have
" a specified scheme and for parts of user interface like menus. A
" color scheme set for a base directory will also
" be used for the sub directories.
" The standard ncurses colors are:
@asm-jaime
asm-jaime / gin.dev.server.go
Created February 7, 2017 18:05
gin server for development which custom settings. (start inside frontend project: go run gin.dev.server.go start 9090 ./build)
package main
import (
"fmt"
"os"
"github.com/gin-gonic/contrib/static"
"github.com/gin-gonic/gin"
)
@asm-jaime
asm-jaime / obj_to_param.js
Created February 23, 2017 13:24
object to url parameter for get query
function obj_to_param(obj) {
return Object.keys(obj).map(function(key) {
return key + '=' + obj[key];
}).join('&');
}
function somef(obj) {
fetch(`${URL}/api/get/some?${obj_to_param(obj)}`)
.then((res) => res.json())
.then((json) => console.log('some: ', json.body))