Skip to content

Instantly share code, notes, and snippets.

@killown
killown / toupper.py
Last active May 5, 2017 13:17
upper all string in loop
#include <iostream>
int main()
{
using namespace std;
string s("Hello World!!!");
// convert s to uppercase
for (auto &reference_to_s : s) // for every char in s (note: reference_to_s is a reference)
reference_to_s = toupper(reference_to_s); // reference_to_s is a reference, so the assignment changes the char
cout << s << endl;
}
@killown
killown / function_string_list.py
Created May 7, 2017 20:33
function string list
// string constructor
#include <iostream>
#include <string>
std::string teste(std::string nums[]){
int b = nums.length();
for(int a=0; a < b; a++)
std::cout << nums[a] << " ";
}
@killown
killown / string_list_size.py
Created May 7, 2017 20:39
string list size
#include <cstddef> // for std::size_t
#include <cstring>
#include <iostream>
template< class T, size_t N >
std::size_t length(const T (&)[N] )
{
return N;
};
int main(){
using namespace std;
@killown
killown / dolphin-transfer.py
Created February 14, 2018 21:48
Uses transfer.sh to send files through dolphin file manager
#!/usr/bin/env python
import sys
import pyperclip
import subprocess
###################################################################################
# transfer.desktop file uses %f and gives full path and we only need the filename #
###################################################################################
##########################################################################