Skip to content

Instantly share code, notes, and snippets.

View Beyarz's full-sized avatar
💎
Searching for Ruby gems

Beyar Beyarz

💎
Searching for Ruby gems
  • Sweden
  • 04:01 (UTC +02:00)
View GitHub Profile
@Beyarz
Beyarz / merge.c
Last active February 16, 2019 14:05
Merge array into string
#include <stdio.h>
#include <string.h>
#define BUF 64
int main()
{
char buffer[BUF] = {'a', 'b', 'c'};
char string[BUF] = "The following says: ";
char combine[BUF];
strcpy(combine, string);
for(int x = 0; x <= 2; x++){
@Beyarz
Beyarz / frame.rb
Last active March 27, 2019 18:36
A universal method to frame in strings.
class Frame
def Frame::this(input)
len = input.length
puts "-"*(len+2)
puts "|"+input+"|"
puts "-"*(len+2)
end
def Frame::side(input)
@Beyarz
Beyarz / delete_prefix.m
Last active March 27, 2019 18:43
An effective way of removing prefix
// Raw data
NSString *appname = @"<NSRunningApplication: 0x600000107d70 (com.apple.iChat - 8272)>";
// Splitting address & appname
NSArray *splitted = [appname componentsSeparatedByString:@" "];
// Getting the pid
NSString *pid = [splitted objectAtIndex:2];
if([pid hasPrefix:@"("]){
@Beyarz
Beyarz / .zshrc
Created April 21, 2019 11:33
perl: warning: Falling back to the standard locale ("C").
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
@Beyarz
Beyarz / disablePolymer.js
Last active May 4, 2019 16:11
Revert to Youtubes old design
/* property
cookie, forEach, includes, join, split
*/
// Go to youtube
// Open the dev tool
// Go to the console section
// Paste the code below
const cookie = document.cookie.split(' ')
@Beyarz
Beyarz / untaggedImage.md
Last active May 21, 2019 21:39
Docker <none> (untagged) images

When building lots of images you end up with a list of untagged builds at the end.

Beyarz 福 ~/Desktop/Work/Web ➤ n1bqd8a|content✓
3287 ± : docker images                                                                                 [0m]
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
web                     latest              0a27aff6030f        2 days ago          401MB
<none>                  <none>              bd215f291219        2 days ago          401MB
<none>                  <none>              faa2d8135eeb        2 days ago          102MB
<none>                  <none>              06bcd360bcd0        2 days ago          102MB
<none>                  <none>              4ee9b19c451b        2 days ago          102MB
@Beyarz
Beyarz / half.html
Last active June 7, 2019 21:51
A simple designed website split in half. I believe this type of style got lots of potential and could be used in a variety of ways with simplicity in mind.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Split</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="style.css" />
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
</head>
@Beyarz
Beyarz / multiplication_table.rb
Last active June 27, 2019 17:11 — forked from ph3nx/multiplication_table.rb
Ruby program that prints a multiplication table (12 x 12 field).
# frozen_string_literal: true
range = 1.upto(12)
range.each do |item|
range.map { |element| print "#{item * element} " } && puts
end
@Beyarz
Beyarz / allocate.c
Last active October 9, 2019 15:26
When allocating memory using malloc, malloc sends the enomem error if the amount of memory requested exceeds the _heap_maxreq. This script bypasses that.
// Working on Windows 10 Insider Preview 18356.1 (19h1_release)
#include <stdio.h>
#include <stdlib.h>
#define byte sizeof(int)
int main(){
char *ptr;
puts("Allocating...");
for(int z = 0; z != -1; z++){
ptr = (char *)malloc(byte);
if(ptr == NULL){
@Beyarz
Beyarz / Reinstall vscode.md
Created October 9, 2019 20:03
Fresh copy of vscode

Reinstall vscode

Delete everything vscode stored

rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist && rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist && rm -fr ~/Library/Caches/com.microsoft.VSCode && rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/ && rm -fr ~/Library/Application\ Support/Code/ && rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/ && rm -fr ~/.vscode/

Download a fresh copy

https://code.visualstudio.com/Download